package edu.ccut.titan.tag.report.tag;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;

import edu.ccut.titan.tag.report.design.CellInfo;

public class TitanCellTag extends TagSupport {
	private static final long serialVersionUID = 5926977096632331461L;
	private String measureVar = "";
	private String rowGroup = null;
	private String columnGroup = null;
	private String clazz = "java.lang.Double";
	private String width = "50";
	private String height = "30";
	private String font = "blob";
	private TitanCrosstabTag crosstabTag;

	@Override
	public int doStartTag() throws JspException {
		crosstabTag = (TitanCrosstabTag) this.getParent();
		return EVAL_BODY_INCLUDE;
	}

	@Override
	public int doEndTag() throws JspException {
		CellInfo cellInfo = new CellInfo();
		cellInfo.setClazz(clazz);
		cellInfo.setColumnGroup(columnGroup);
		cellInfo.setFont(font);
		cellInfo.setHeight(height);
		cellInfo.setMeasureVar(measureVar);
		cellInfo.setRowGroup(rowGroup);
		cellInfo.setWidth(width);
		crosstabTag.addCellInfo(cellInfo);
		return SKIP_BODY;
	}

	public String getMeasureVar() {
		return measureVar;
	}

	public void setMeasureVar(String measureVar) {
		this.measureVar = measureVar;
	}

	public String getRowGroup() {
		return rowGroup;
	}

	public void setRowGroup(String rowGroup) {
		this.rowGroup = rowGroup;
	}

	public String getColumnGroup() {
		return columnGroup;
	}

	public void setColumnGroup(String columnGroup) {
		this.columnGroup = columnGroup;
	}

	public String getClazz() {
		return clazz;
	}

	public void setClazz(String clazz) {
		this.clazz = clazz;
	}

	public String getWidth() {
		return width;
	}

	public void setWidth(String width) {
		this.width = width;
	}

	public String getHeight() {
		return height;
	}

	public void setHeight(String height) {
		this.height = height;
	}

	public String getFont() {
		return font;
	}

	public void setFont(String font) {
		this.font = font;
	}

}
